package com.web.quartz.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.quartz.SchedulerFactoryBeanCustomizer;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.stereotype.Component;

@Component
public class QuartzConfig implements SchedulerFactoryBeanCustomizer {
	
	@Autowired
	private QuartzJobListener quartzJobListener;
	
	@Autowired
	private QuartzSchedulerListener quartzSchedulerListener;
	
	@Autowired
	private QuartzTriggerListener quartzTriggerListener;

	@Override
	public void customize(SchedulerFactoryBean schedulerFactoryBean) {
		schedulerFactoryBean.setGlobalJobListeners(quartzJobListener);
		schedulerFactoryBean.setSchedulerListeners(quartzSchedulerListener);
		schedulerFactoryBean.setGlobalTriggerListeners(quartzTriggerListener);
	}

}
